Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

deMesh.hpp

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////////////////////////
00002 /// @file deMesh.hpp
00003 ///
00004 /// @brief mesh class interface
00005 ///
00006 /// @author Assassin
00007 ///
00008 /// This file is the intellectual property of Novus Delta, LLC.. Usage of the
00009 /// contents of this file is subject to the Destiny3D Member License which
00010 /// can be found at http://www.destiny3d.com.  Any other usage is prohibited.
00011 ///
00012 /// This file is distributed "AS IS" without warranty of any kind.  Novus
00013 /// Delta, LLC. does not guarantee the fitness of the contents of this file
00014 /// for any particular purpose.
00015 ///
00016 /// Copyright (C) 2001-2003 Novus Delta, LLC. All Rights Reserved.
00017 ///
00018 /// <hr>
00019 ///                                 Change History
00020 /// <hr>
00021 ///
00022 /// @date Aug 2003
00023 /// @author Assassin
00024 /// @remarks Creation
00025 ///
00026 ///////////////////////////////////////////////////////////////////////////////
00027 
00028 #ifndef DEMESH_HPP
00029 #define DEMESH_HPP
00030 
00031 #include "deGlobalTypes.hpp"
00032 #include "deBrush.hpp"
00033 
00034 class IdeMesh;
00035 class IdeSurface;
00036 class IdeBrush;
00037 
00038 // factory functions
00039 /// Create an instance of IdeMesh
00040 DEBRUSH_API IdeMesh*    IdeMesh_CreateMesh();
00041 /// Get the IdeMesh WorldObject interface ID
00042 DEBRUSH_API long        IdeMesh_GetWOInterfaceID();
00043 DEBRUSH_API deBoolean   IdeMesh_LoadStaticFromXFile(const char * filename, IdeMesh* pMesh, const deTransformInfo * Transform = NULL);
00044 
00045 struct deMeshVertexData
00046 {
00047     deVertex *positions;
00048     deVertex *normals;
00049     deTexCoord *uvcoords; // deTexCoord[numtexstages][numpoints]
00050     deARGB *colors;
00051     u32 numpoints;
00052     u32 numtexstages;
00053 };
00054 struct deMeshIndexData
00055 {
00056     // set only one of these to a valid pointer, and the other to NULL
00057     u16* indices16;
00058     u32* indices32;
00059     u32 numindices;
00060     u32 indexoffset;
00061     IdeSurface* surface;
00062 };
00063 
00064 /// A storage class for static triangulated meshes.
00065 /// Related functions: IdeMesh_CreateMesh, IdeMesh_GetWOInterfaceID
00066 //class IdeMesh : virtual public IdeWorldObject
00067 DE3D_INTERFACE(IdeMesh, IdeWorldObject)
00068 {
00069 protected:
00070     ~IdeMesh() {}
00071 public:
00072     /// Destroys all contained geometry
00073     virtual void ClearGeometry() = 0;
00074 
00075     /// Builds from a brush
00076     virtual deBoolean BuildFromBrushGeometry(IdeBrush* brush) = 0;
00077 
00078     // next 3 functions used for building compiled meshes from raw mesh data
00079     /// Builds from a set of vertex & index data, set through AddVertices and AddIndices.
00080     /// This will only take into account the geometry that has been input through AddVertices and AddIndices
00081     /// since the last time a mesh was built.
00082     virtual deBoolean BuildFromVertices() = 0;
00083     /// adds vertex data, fills indexoffset with offset to beginning of vertex data in main vertex buffer
00084     virtual deBoolean AddVertices(const deMeshVertexData & vertexdata, long & indexoffset) = 0;
00085     /// adds index data, which contains indexoffset and surface information
00086     virtual deBoolean AddIndices(const deMeshIndexData & indexdata) = 0;
00087 
00088     // next few functions used for manually editing a mesh.
00089     // do not use both these and the Build___ functions.
00090     /// Sets the number of submeshes, and destroys all existing submeshes
00091     virtual void SetNumSubMeshes(u32 NumSubs, deBoolean Dynamic = deTRUE) = 0;
00092     virtual deBoolean SetSurface(u32 SubNum, IdeSurface* Surface) = 0;
00093     virtual IdeSurface* GetSurface(u32 SubNum) = 0;
00094     virtual deBoolean SetNumFaces(u32 SubNum, u32 NumFaces) = 0;
00095     virtual u32 GetNumFaces(u32 SubNum) = 0;
00096     // feed in variables that can store 2d arrays, [NumSubs][NumFaces[SubNum]*3]
00097     virtual deBoolean Lock(deVertex** &positions, deTexCoord2** &uvcoords, deARGB** &colors) = 0;
00098     virtual deBoolean Unlock(deVertex** &positions, deTexCoord2** &uvcoords, deARGB** &colors) = 0;
00099 
00100     // below mainly for internal use
00101     virtual IdeVertexBuffer* GetMainVertexBuffer() = 0;
00102     virtual long GetNumSubMeshes() = 0;
00103     virtual IdeVertexBuffer* GetSubMeshVertexBuffer(long index) = 0;
00104     virtual IdeVertexBuffer* GetSubMeshIndexBuffer(long index) = 0;
00105     virtual IdeSurface* GetSubMeshSurface(long index) = 0;
00106 
00107     virtual deDouble GetBoundRadius() = 0;
00108     virtual void GetBBox(deAABB& outBox) = 0;
00109 };
00110 
00111 #endif
00112 

Generated on Mon Sep 12 19:58:31 2005 for Destiny3D by doxygen1.3-rc3